The present invention relates to a computing device having an optimized file system and methods for use therein.
Computing devices often support file systems. Since computational and memory resources are limited in computing devices, there is a need to make these file systems as efficient as possible. This is especially true for embedded computing devices where file operations are frequently performed, such as in embedded computing devices tasked with logging continuous data streams.
One area where efficiencies in file systems for computing devices are needed is reducing the time spent searching for available memory locations in a target physical memory (henceforth referred to simply as target memory) when performing data writes. In a typical file system, whenever new data needs to be written to a target memory, if all the sectors in the current cluster are exhausted, the file system searches through clusters of the target memory in sequence, always starting from the same start cluster of a sequence number close to zero, until an available cluster is found. An advantage of this approach is that if one cluster becomes available (such as when a user deletes a file) while other clusters of higher sequence numbers remain unavailable, the available cluster is quickly reallocated. On the other hand, a disadvantage of this approach is that always starting a sequential search for an available cluster from the same start cluster is a time-consuming process that can starve other processing tasks, dramatically slow operation of the computing device and reduce battery life of the computing device.
Another area where efficiencies in file systems for computing devices are needed is in minimizing cache faults when performing data reads and writes. For example, before a file system writes new data to a sector of a target memory, existing data from the sector must be read to a buffer where the new data are merged with the existing data. If the new data were instead written directly to the target memory (without first buffering the sector to a buffer), the existing data in the target memory would be lost. Accordingly, in a typical file system, a single cache is assigned to retain data from the most recently accessed sector of the target memory. Retention in a cache of data from the most recently accessed sector can speed-up data writes by obviating the need to read data from the target memory to the buffer when consecutive data writes are made to the same sector. Retention in the cache of data from the most recently accessed sector can also speed-up data reads by obviating the need to read data from the target memory to the buffer when consecutive data reads are made from the same sector. However, since consecutive data reads and writes are often made to different sectors, cache faults necessitating reading of data from the target memory are frequent, leading to extra processing that can starve other processing tasks, dramatically slow operation of the computing device and reduce battery life of the computing device.